<?php

use App\Models\WorkOrder\WorkOrderApplyMainModel;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class AlterTableWorkOrderApplyMainAddType extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('work_order_apply_main', function (Blueprint $table) {

            $table->unsignedTinyInteger("sourceType")
                  ->comment(enumToMigrationComment(WorkOrderApplyMainModel::SOURCE_TYPE_TEXT, "工单来源"))
                  ->default(0)
                  ->after("workOrderNo");
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('work_order_apply_main', function (Blueprint $table) {
            $table->dropColumn([
                "sourceType"
            ]);
        });
    }
}
